<div class="tableCRUD">

	<table class="table table-bordered">

		<tr>
<?php
$indexAction = str_replace('.table', '.index', $action);

foreach ($header as $el => $val) {
	if ($val['canSort']) {
		$fieldSort = 0;
		if ($val['field'] == $sortField) {
			$fieldSort = ! $sort;
		}
		
		$paramsTemp = $params;
		?>
			<td><a
				data-ajax-href="<?= $this->url($action, array_merge($paramsTemp, [
					'sortField' => $val['field'],'sortType'=>$fieldSort]))?>"
				data-ajax-container=".tableCRUD"
				href="<?= $this->url($indexAction,array_merge($paramsTemp,[
					'sortField' => $val['field'],'sortType'=>$fieldSort]))?>">
				   <?=$el?></a>
				   <?php if($val['field']==$sortField){?>
				   <span
				class="<?= $fieldSort 
					? 'glyphicon glyphicon-chevron-down' 
					: 'glyphicon glyphicon-chevron-up'?>"></span>
				   <?php }?>
				   </td>
		<?php } else { ?>
			<td><?=$el?></td>
		<?php 
	}
}
?><td>Control</td>
</tr>
<?php

foreach ($arrId as $el) {
	echo $this->action('crud.row', [
			'configClass' => $conf,
			'id' => $el,
			'className' => $className,
			'baseAction' => str_replace('.table', '', $action)
		]);
}
?></table>



<?php

$params['sortType'] = $sort;
$params['sortField'] = $sortField;

echo $this->action('pagination', 
	[
		'page' => $currentPage,
		'pages' => $pages,
		'params' => $params,
		'actionCall' => $indexAction,
		'ajaxOptions' => [
			'container' => '.tableCRUD',
			'actionCall' => $action
		]
	])?>
</div>